package com.yanfan.ccapicode.service.token;

import com.yanfan.ccapicode.handler.factory.NoOauth2GetTokenHandlerFactory;
import org.springframework.beans.factory.InitializingBean;

/**
 * :)
 * 抽象初始化方法
 * */
public abstract class AbstractNonStandardTokenHandler implements NonStandardTokenHandler, InitializingBean {

    private final NoOauth2GetTokenHandlerFactory factory;

    protected AbstractNonStandardTokenHandler(NoOauth2GetTokenHandlerFactory factory) {
        this.factory = factory;
    }

    @Override
    public void deliveryLoop(String clientId, Long time) {

    }

    abstract String getKey();

    @Override
    public void afterPropertiesSet() {
        factory.register(getKey(), this);
    }
}
